﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="DrillingKPI.aspx.cs" Inherits="BSCMFF.Web.Pages.BSC_Setup.DrillingKPI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">


    <div style="width: 200px; float: left">

        <script type="text/javascript">
            function onNodeClicked(sender, args) {
                showDetails(args.get_node());
//                $get("<%= LabelDescription.ClientID %>").hidden = true;
//                $get("<%= LabelEmployee.ClientID %>").hidden = true;
            }

            function showDetails(node) {
                if (node.get_attributes().getAttribute("NodeType")){
                    if (node.get_attributes().getAttribute("NodeType") == "KPI") {
//                    var position = node.get_attributes().getAttribute("NodeType");
                    var name = node.get_text();
//                    var email = node.get_attributes().getAttribute("Email");
//                    var phone = node.get_attributes().getAttribute("Phone");
                    var description = node.get_attributes().getAttribute("Description");
                    $get("details").style.display = "block";
                    $get("<%= description.ClientID %>").innerHTML = description;
                    $get("<%= name.ClientID %>").innerHTML = name;

                    
                    $get("<%= LabelEmployee.ClientID %>").hidden = true;

                    $get("<%= LabelType.ClientID %>").innerHTML = "KPI";

                    $get("<%= LabelDescription.ClientID %>").hidden = false;
                    
                    }
                    else { ///personal kpi
                        var name = node.get_text();
                        var description = node.get_attributes().getAttribute("Description");
                        var userID = node.get_attributes().getAttribute("UserID");
                        var fullname = node.get_attributes().getAttribute("Fullname");
                        $get("details").style.display = "block";
                        $get("<%= description.ClientID %>").innerHTML = description;
                        $get("<%= name.ClientID %>").innerHTML = name;
                        $get("<%= employeeLB.ClientID %>").innerHTML = fullname;
                        $get("<%= employeeLB.ClientID %>").href = "../Administration/EmployeeInfo.aspx?EmpoloyeeID=" + userID;

                        $get("<%= LabelEmployee.ClientID %>").hidden = false;

                        $get("<%= LabelType.ClientID %>").innerHTML = "PKPI";

                        $get("<%= LabelDescription.ClientID %>").hidden = false;
                    }
                    

                }
                else {
                    $get("details").style.display = "none";
                }
            }
        </script>

        <telerik:RadTreeView ID="RadTreeView1" runat="Server" OnClientNodeClicked="onNodeClicked">
            
        </telerik:RadTreeView>
    </div>
    <div  style="float: right; width: 310px; background-image: url('~/Images/bg_sbu.jpg') no-repeat ; height: 200px;
            padding: 3px 0 0 30px; margin-top: 1px;">
        <div style="color: #4888a3; font-size: 23px; padding-bottom: 10px;">
            <asp:Label runat="Server" ID="LabelType" />
            <asp:Label runat="Server" ID="name" />
        </div>
        <div id="details" style="font-size: 12px; line-height: 21px;">
            <asp:Label runat="server" ID="LabelDescription" Text="Description: " Visible="true" />
            <asp:Label runat="server" ID="description" />
            <br />
            <asp:Label ID="LabelEmployee" runat="server" Text="Employee: " Visible="true"></asp:Label>
            <asp:Label runat="server" ID="employee" />
            <asp:LinkButton runat="server" ID="employeeLB"></asp:LinkButton>
           
        </div>
    </div>
</asp:Content>
